home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10986 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.sinet.slb.com!usenet
  2. From: "Vinh D. Nguyen" <vnguyen@sugar-land.anadrill.slb.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help, C++ '&' dereferencer
  5. Date: Mon, 11 Mar 1996 18:27:04 -0600
  6. Organization: Schlumberger Anadrill
  7. Message-ID: <3144C4D8.18DC@sugar-land.anadrill.slb.com>
  8. References: <4i153m$pgf@bignews.shef.ac.uk>
  9. NNTP-Posting-Host: 163.185.118.40
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Eric Smith wrote:
  16. > My manuals and online help is a little vague on this one so can anyone
  17. > please simply explain to me what the  &  sign ( or 'dereferencer' I believe)
  18. > is doing in the following command line where 'value' should end up as 1 or 0.
  19. >     value=((inportb(0x1B4) & 0x20)>>5);
  20.  
  21. Your & operator in this context, my friend, is the bitwise AND operator.
  22. What you are doing is to perform a bit-by-bit AND of inportb(0x1B4) and 0x20
  23. and then shifting the result right by 5 bits.
  24.  
  25. I hope this helps.
  26.  
  27. -- 
  28. --------------------------------------------------------------------------
  29. * Vinh Nguyen                                            vnguyen@slb.com *
  30. * Drilling Information Products - Senior Engineer                        *
  31. * 200 Gillingham Ln.                             (713) 275-7524 (Office) *
  32. * Sugarland, TX 77478                            (713) 275-8098 (FAX)    *
  33. --------------------------------------------------------------------------
  34.